
import axios from 'axios';

/**
 * 工资结算
 */
export class SalarySettlementService {
    // 分页查询列表
    static findSalarySettlements (queryParams) {
        return axios({
            url: '/restaurant/staff/SalarySettlement/findSalarySettlements',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的工资结算
    static findSalarySettlement (salarySettlementId) {
        const query = {
            salarySettlementId
        }
        return axios({
            url: '/restaurant/staff/SalarySettlement/findSalarySettlement',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的工资结算(包含外键名称)
    static findSalarySettlementForView (salarySettlementId) {
        const query = {
            salarySettlementId
        }
        return axios({
            url: '/restaurant/staff/SalarySettlement/findSalarySettlementForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的工资结算(包含外键名称)
    static findSalarySettlementForEdit (salarySettlementId) {
        const query = {
            salarySettlementId
        }
        return axios({
            url: '/restaurant/staff/SalarySettlement/findSalarySettlementForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的工资结算(只提取ID 和 Name)
    static findSalarySettlementsWithIdNameById (salarySettlementId) {
        const query = {
            salarySettlementId
        }
        return axios({
            url: '/restaurant/staff/SalarySettlement/findSalarySettlementsWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询工资结算集合(只提取ID 和 Name)
    static findSalarySettlementsWithIdNameByName (salarySettlementName) {
        const query = {
            salarySettlementName
        }
        return axios({
            url: '/restaurant/staff/SalarySettlement/findSalarySettlementsWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存工资结算
    static saveSalarySettlement (salarySettlement) {
        const query = {}
        return axios({
            url: '/restaurant/staff/SalarySettlement/saveSalarySettlement',
            method: 'POST',
            params: query,
            data: salarySettlement
        });
    }

    //修改保存工资结算
    static updateSalarySettlement (salarySettlement) {
        const query = {}
        return axios({
            url: '/restaurant/staff/SalarySettlement/updateSalarySettlement',
            method: 'POST',
            params: query,
            data: salarySettlement
        });
    }

    //根据ID查询指定的工资结算(只提取ID 和 Name)
    static deleteSalarySettlement (salarySettlementId) {
        const query = {
            salarySettlementId
        }
        return axios({
            url: '/restaurant/staff/SalarySettlement/deleteSalarySettlement',
            method: 'POST',
            params: query,
        });
    }


  static calculateSalary(staffId, startDate, endDate) {
    const query = {
      staffId,
      startDate,
      endDate
    }
    return axios({
      url: '/restaurant/staff/SalarySettlement/calculateSalary',
      method: 'POST',
      params: query,
    });
  }
}
